package com.bstek.uflo.console.view.security.filter;

import java.util.List;

import org.springframework.util.StringUtils;

import com.bstek.uflo.process.security.Authority;
import com.bstek.uflo.process.security.ComponentAuthority;


/**
 * @author Jacky.gao
 * @since 2013年10月21日
 */
public abstract class AbstractElementFilter implements ElementFilter {
	protected Authority filterComponent(String id,List<ComponentAuthority> componentAuthorities){
		if(StringUtils.isEmpty(id))return null;
		for(ComponentAuthority authority:componentAuthorities){
			String componentId=authority.getComponent();
			if(StringUtils.isEmpty(componentId))continue;
			if(componentId.equals(id)){
				return authority.getAuthority();
			}
			
		}
		return null;
	}
}
